﻿using System;
using System.Data;
using visinia.SmartEngine.Providers;

namespace ErrorPageZ.Providers
{
    public abstract partial class ErrorPageZDataProvider    
    {
        #region INIT
        private static ErrorPageZDataProvider _provider;
        private static object _lock = new object();

        public static ErrorPageZDataProvider Provider
        {
            get { InternalInitialize(); return _provider; }
        }
        private static void InternalInitialize()
        {
            if (_provider == null)
            {
                lock (_lock)
                {
                    if (_provider == null)
                    {
                        _provider = (ErrorPageZDataProvider)ProviderController.CreateDataProvider("ErrorPageZ");
                        if (_provider == null)
                            throw new Exception("Unable to load default ErrorPageZDataProvider");
                    }
                }
            }
        }
        #endregion

        #region ErrorPageZ
        public abstract IDataReader GetCustomErrorPages();
        public abstract void SetCustomErrorPage(int statusCode, string redirect, int PageId);
        public abstract void ResetCustomErrorPage(int statusCode);
        #endregion
    }
}
